package com.kawins.supers.message.socket.bean;

import java.io.Serializable;
import java.util.UUID;

/**
 * @author rankai
 *         createTime 2017-11-2017/11/1 11:04
 */
public class SocketMessage implements Serializable {

    private Object id;

    private String msgCode;
    //类型
    private Object type;
    //等级
    private int level;
    //标题
    private String title;
    //URL
    private String url;
    //类容
    private String content;

    public SocketMessage(Object type) {
        this.type = type;
        this.msgCode = UUID.randomUUID().toString();
    }

    public Object getId() {
        return id;
    }

    public void setId(Object id) {
        this.id = id;
    }

    public String getMsgCode() {
        return msgCode;
    }

    public Object getType() {
        return type;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }


    public static final class Builder {
        private Object id;
        //等级
        private int level;
        //标题
        private String title;
        //URL
        private String url;
        //类容
        private String content;

        private Builder() {
        }

        public static Builder get() {
            return new Builder();
        }

        public Builder setId(Object id) {
            this.id = id;
            return this;
        }

        public Builder setLevel(int level) {
            this.level = level;
            return this;
        }

        public Builder setTitle(String title) {
            this.title = title;
            return this;
        }

        public Builder setUrl(String url) {
            this.url = url;
            return this;
        }

        public Builder setContent(String content) {
            this.content = content;
            return this;
        }

        public SocketMessage build(Integer type) {
            SocketMessage socketMessage = new SocketMessage(type);
            socketMessage.setId(id);
            socketMessage.setLevel(level);
            socketMessage.setTitle(title);
            socketMessage.setUrl(url);
            socketMessage.setContent(content);
            return socketMessage;
        }
    }
}
